home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr31 / hades.zip / DICTWORD.C < prev    next >
C/C++ Source or Header  |  1992-04-10  |  2KB  |  93 lines

  1.  
  2. /***************
  3. **
  4. **  dictword.c
  5. **  last revised: april 9, 1992
  6. **
  7. **  implementation of word-converting functions.
  8. **  This module deals with conversion of words that are to be stored in a
  9. **  dictionary (capitalise word, lowercase word, first letter capital,
  10. **  etc.)
  11. **
  12. **  Written for DESPERATE password-cracker with HADES encryption engine by
  13. **  Remote.
  14. **
  15. **  Copyright (C)1992, Zabkar
  16. **
  17. **  root@waves.hacktic.nl (Zabkar)
  18. **  root@room101.hacktic.nl (Remote)
  19. **
  20. */
  21.  
  22. #include <string.h>
  23. #include <ctype.h>
  24. #include "dictword.h"
  25.  
  26.  
  27.  
  28. /***************
  29.  all_lower()
  30.  converts a string to its lowercase-equivalent
  31. ***************/
  32.  
  33. char *all_lower(char *d, char *s)
  34. {
  35.     int i;
  36.  
  37.     for (i=0; i<strlen(s); i++)
  38.         d[i] = tolower(s[i]);
  39.  
  40.     d[i] = '\0';
  41.     return (d);
  42. }
  43.  
  44.  
  45.  
  46. /***************
  47.  all_upper()
  48.  converts a string to its uppercase-equivalent
  49. ***************/
  50.  
  51. char *all_upper(char *d, char *s)
  52. {
  53.     int i;
  54.  
  55.     for (i=0; i<strlen(s); i++)
  56.         d[i] = toupper(s[i]);
  57.  
  58.     d[i] = '\0';
  59.     return (d);
  60. }
  61.  
  62.  
  63.  
  64. /***************
  65.  first_upper()
  66.  converts a string to its lowercase-equivalent, with the first letter
  67.  capitalized.
  68. ***************/
  69.  
  70. char *first_upper(char *d, char *s)
  71. {
  72.     all_lower(d, s);
  73.  
  74.     d[0] = toupper(s[0]);
  75.  
  76.     return (d);
  77. }
  78.  
  79.  
  80.  
  81. /***************
  82.  reverse()
  83.  converts a string to its reversed-equivalent.
  84. ***************/
  85.  
  86. char *reverse(char *d, char *s)
  87. {
  88.     strcpy(d, s);
  89.     return (strrev(d));
  90. }
  91.  
  92. /* EOF DICTWORD.C */
  93.